<template>
  <div>
    <div>播放页面---{{ id }}</div>
    <div class="info">
      <img :src="imgUrl" alt="">
      <div class="name">{{ name }}</div>
    </div>
    <MusicList :list="list" :isShow="true"></MusicList>
    <!-- 歌曲 -->
    <!-- <div class="list">
      <h3>歌曲列表</h3>
        <div class="item" v-for="(item,index) in list" :key="item.id">
          <div class="first"> {{ index+1 }}</div>
          <div class="left">
            <div class="subtitle">{{item.name}}<span>({{item.alia[0]}})</span></div>
            <div class="author" ><span v-for="ele in item.ar" :key="ele.id" class="ele"> {{ ele.name }}</span>
            - {{ item.al.name }}</div>
             <div class="right"></div>
            </div>
          </div>
        </div> -->
  </div>
</template>

<script>
import MusicList from '@/components/MusicList.vue'
export default {
  data(){
    return{
      name:'',
      imgUrl:'',
      list:[]
    }
  },
  components:{MusicList},
props:['id'],
created(){
  this.musicplaylist()
},
methods:{
  async musicplaylist(){
    const {data:res} = await this.$api.musicplaylist()
    console.log(res);
    this.imgUrl = res.playlist.coverImgUrl
    this.name = res.playlist.name
    this.list = res.playlist.tracks
    }
}
}
</script>

<style lang="less" scoped>
.info{
  height: 126px;
  padding: .9rem;
  background-color: #eee;
  display: flex;
  
  .name{
    flex: 1;
    font-size: 17px;
    line-height: 1.3;
    color: #3a3838;
    height: 44px;
    padding-left: .2rem;
  }
}
.list{
  h3{
    font-weight: 400;
    height: 23px;
    line-height: 23px;
    padding: 0 10px;
    font-size: 12px;
    color: #666;
    background-color: #eeeff0;
  }
}
.item{
  display: flex;
  padding: 6px 13px;
  border-bottom: 1px solid #efebeb;
  .first{
    text-align: center;
    justify-content: center;
    font-size: 17px;
    width: 40px;
    color: #999;
    margin-left: -10px;
    margin-top:10px;

  }
  .left{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
    flex: 1;
    .subtitle{
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
    span{
      overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
      color: #888;
    margin-left: 4px;
    }
  }
  .author{
    font-size: 12px;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
  }
  .ele::after{
    content: ' / ';
  }
  .ele:last-child::after{
    content:'' ;
  }
}
  
  .right{
    width: .9rem;
  }
}
  

</style>